//
//  UIImage+JwCate.h
//  JwPack
//
//  Created by 陈警卫 on 2024-07-30.
//

#import <UIKit/UIKit.h>

@interface UIImage (JwCate)

/// 原色图片
- (UIImage *)jw_renderOriginal;

/// 颜色渲染
- (UIImage *)jw_imageByTintColor:(UIColor *)color;

/// 颜色渲染
- (UIImage *)jw_imageByTintColor:(UIColor *)color blendMode:(CGBlendMode)blendMode;

/// 颜色图片
+ (UIImage *)jw_createImageWithColor:(UIColor *)color;

/// 颜色图片
+ (UIImage *)jw_createImageWithColor:(UIColor *)color size:(CGSize)size;

/// 圆角图像
- (UIImage *)jw_imageByRoundCornerRadius:(CGFloat)radius;
/// 设置圆角 边框
- (UIImage *)jw_imageByRoundCornerRadius:(CGFloat)radius
                             borderWidth:(CGFloat)borderWidth
                             borderColor:(UIColor *)borderColor;
/// 设置圆角 边框
- (UIImage *)jw_imageByRoundCornerRadius:(CGFloat)radius
                                 corners:(UIRectCorner)corners
                             borderWidth:(CGFloat)borderWidth
                             borderColor:(UIColor *)borderColor
                          borderLineJoin:(CGLineJoin)borderLineJoin;

/// view转image
+ (UIImage *)jw_imageWithView:(UIView *)view;

/// 模糊图片
+ (UIImage *)jw_blurWithImage:(UIImage *)image withBlurLevel:(CGFloat)blur;

/// 调整图片大小
+ (UIImage *)jw_resizedImage:(UIImage *)image size:(CGSize)size;

/// 调整图片大小
- (UIImage *)jw_resizeImageWithSize:(CGSize)size;

/// 剪切图像
- (UIImage *)jw_imageByCropRect:(CGRect)rect;

/// 多边形图片裁剪
- (UIImage *)jw_imageByCropWithSize:(CGSize)size points:(NSMutableArray *)points;

/// 点区域转换
- (CGPoint)jw_convertPoint:(CGPoint)point fromRect:(CGSize)fromRect toRect:(CGSize)toRect;

/// 在指定矩形内绘制图像
- (void)jw_drawInRect:(CGRect)rect withContentMode:(UIViewContentMode)contentMode clipsToBounds:(BOOL)clips;

/// 缩放图像 图像内容根据ContentMode更改
- (UIImage *)jw_imageByResizeToSize:(CGSize)size contentMode:(UIViewContentMode)contentMode;

@end
